﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAL;
using BLL;
namespace PhongMachTu.GUI
{
    public partial class frmBaoCaoThuoc : Form
    {
        public frmBaoCaoThuoc()
        {
            InitializeComponent();
            for (int i = 1; i <= 12; i++)
            {
                cmbThang.Items.Add(i);
            }
            cmbThang.Text = DateTime.Now.Month.ToString();
        }

        private void frmBaoCaoThuoc_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = bllKhamBenh.ThongKeThuoc(Month, Year);
        }

        int Month = DateTime.Now.Month;
        int Year = DateTime.Now.Year;
        KhambenhBLL bllKhamBenh = new KhambenhBLL();
        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = bllKhamBenh.ThongKeThuoc(Month, Year);
        }

        private void cmbThang_SelectedIndexChanged(object sender, EventArgs e)
        {
            Month = int.Parse(cmbThang.Text);
            dataGridView1.DataSource = bllKhamBenh.ThongKeThuoc(Month, Year);
            if (dataGridView1.Rows.Count-1 < 0)
            {
                MsgBox.Info("Chưa có dữ liệu !");
            }
        }
    }
}
